<?php
/**
 * 老师获取在教班级信息
 * @author shej E-mail:28708@qq.com
 */
require_once '../../dz_framework/init.php';

$user_id = isset($_REQUEST['user_id'])?$_REQUEST['user_id']:"";
$year = date("Y",time());
// limit 10 最近的10个课时

$getallclass = DB::fetch_all('select c.class_id,c.class_name,c.grade_num,c.class_num from '.DB::table('class_member')." cm left join ".DB::table('class')." c on cm.class_id=c.class_id where cm.user_id='".$user_id."' and (cm.cm_type=20 or cm.cm_type=22) and c.class_year=".$year." limit 10");	

if($getallclass)
{	
	echo json_encode($getallclass); exit;
	
}else{
	
	echo json_encode(array('error'=>'no class data')); exit;
}